package week08;


	import java.util.*;

	public class week0802 {


	    public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        Set<String> set = new HashSet<String>();
	        while(sc.hasNextLine()) {
	            String s = sc.nextLine();
	            if(s.equals("!!!!!"))
	                break;
	            String t = "";
	            for (int i = 0; i < s.length(); i++) {
	                if(s.charAt(i) == ' ') {
	                    if(t!="") {
	                        set.add(t);
	                    }
	                    t = "";
	                    continue;
	                }
	                if((i == s.length()-1)&&(s.charAt(i)!=' ')) {
	                    t+=s.charAt(i);
	                    set.add(t);
	                    break;
	                }
	                t += s.charAt(i);
	            }

	        }
	        int i = 0;
	        String[] a = new String[set.size()];
	        for (String s:
	             set) {
	            a[i++] = s;
	        }
	        Arrays.sort(a);
	        System.out.println(set.size());
	        for (int j = 0; j <10 ; j++) {
	            if(j== set.size()) {
	                break;
	            }
	            System.out.println(a[j]);
	        }
	        sc.close();
	    }

	}

